package com.lanyou.esb.cook.proxy.meta;

import java.rmi.NoSuchObjectException;

import org.apache.commons.lang3.StringUtils;

/**
 * 接口请求的方法 <br>
 * 描述：<br>
 * 0：GET；1：HEAD；2：PUT：3：DELETE；4：POST；5：OPTIONS；
 * 
 * @author Davey.wu
 */
public enum ReqMethod {
	GET("0"), HEAD("1"), PUT("2"), DELETE("3"), POST("4"), OPTIONS("5"), OTHER(
			"6");
	public final String ValueCode;

	private ReqMethod(String code) {
		this.ValueCode = code;
	}

	public static ReqMethod get(String valueCode) throws NoSuchObjectException {
		if (StringUtils.isBlank(valueCode)) {
			throw new NullPointerException();
		}
		for (ReqMethod type : ReqMethod.values()) {
			if (type.ValueCode.equals(valueCode)) {
				return type;
			}
		}
		throw new NoSuchObjectException(valueCode);
	}
}
